home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / M2Crypto / ftpslib.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2008-10-13  |  2KB  |  62 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. from ftplib import *
  5. from ftplib import parse150, parse227
  6. from ftplib import error_reply, error_temp, error_perm, error_proto
  7. import socket
  8. import time
  9. import SSL
  10. DEFAULT_PROTOCOL = 'sslv23'
  11.  
  12. class FTP_TLS(FTP):
  13.     
  14.     def __init__(self, host = None, ssl_ctx = None):
  15.         if ssl_ctx is not None:
  16.             self.ssl_ctx = ssl_ctx
  17.         else:
  18.             self.ssl_ctx = SSL.Context(DEFAULT_PROTOCOL)
  19.         if host:
  20.             self.connect(host)
  21.         
  22.         self.prot = 0
  23.  
  24.     
  25.     def auth_tls(self):
  26.         self.voidcmd('AUTH TLS')
  27.         s = SSL.Connection(self.ssl_ctx, self.sock)
  28.         s.setup_ssl()
  29.         s.set_connect_state()
  30.         s.connect_ssl()
  31.         self.sock = s
  32.         self.file = self.sock.makefile()
  33.  
  34.     
  35.     def auth_ssl(self):
  36.         raise NotImplementedError
  37.  
  38.     
  39.     def prot_p(self):
  40.         self.voidcmd('PBSZ 0')
  41.         self.voidcmd('PROT P')
  42.         self.prot = 1
  43.  
  44.     
  45.     def prot_c(self):
  46.         self.voidcmd('PROT C')
  47.         self.prot = 0
  48.  
  49.     
  50.     def ntransfercmd(self, cmd, rest = None):
  51.         (conn, size) = FTP.ntransfercmd(self, cmd, rest)
  52.         if self.prot:
  53.             conn = SSL.Connection(self.ssl_ctx, conn)
  54.             conn.setup_ssl()
  55.             conn.set_connect_state()
  56.             conn.set_session(self.sock.get_session())
  57.             conn.connect_ssl()
  58.         
  59.         return (conn, size)
  60.  
  61.  
  62.